package thread;

/**
 * @Author: admin
 * @Description:
 * @Date: 2019/3/3 16:32
 */

public class ThreadAsync extends Thread {

    public void print(Object lock,String str){
        synchronized (lock) {
            System.out.println(Thread.holdsLock(lock) + " : " + str);
        }
    }

    public static void main(String[] args) {
        Integer i=new Integer(1);
        ThreadAsync threadAsync=new ThreadAsync();
        threadAsync.print(i, "123");
    }
}
